package com.meituan;

import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.meituan.domain.Sex;
import com.meituan.service.UserService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * Created by lizhenxing on 2017/3/15.
 */
@SpringBootApplication
@MapperScan(basePackages = "com.meituan.mapper")
public class Application implements CommandLineRunner{

    @Autowired
    private UserService userService;


    public static void main(String[] args) throws InterruptedException, JsonProcessingException {
        SpringApplication.run(Application.class, args);

    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println(userService.find(Sex.WOMAN));

        System.out.println(userService.find("jfksdjf"));

        System.out.println(userService.findById(null));

        System.out.println(userService.count("fsdf"));
    }


    static class T {
//        @JsonProperty("Username")
        private String UserName;

//        @JsonProperty("UserName")
        @JsonGetter("UserName")
        public String getUserName() {
            return UserName;
        }

//        @JsonIgnore
        public void setUserName(String userName) {
            UserName = userName;
        }
    }

}
